<?php

/*
  Action – Duration	$5

  You only draw 3 cards (instead of 5) in this turn’s Clean-up phase.
  Take an extra turn after this one. This can’t cause you to take more than two consecutive turns.

 */

class Outpost extends Card implements iAction, iKingdom, iDuration, iSeaside {

    public function __construct() {
        parent::__construct("Outpost", 5);
        $this->duration = 1;
        $this->undoPlay = false;
        $this->undoBuy = true;
    }

    public function getDescription() {
        return array(
            "You only draw 3 cards (instead of 5) in this turn’s Clean-up phase.",
            "Take an extra turn after this one. This can’t cause you to take more than two consecutive turns.");
    }
    
    public function play(Game $game, $isRealCard) {
        $cards = $game->getDurationAffects();
        foreach ($cards as $card_arr) {
            $card = $card_arr['card'];
            if ($this->getKey() == $card->getKey()) {
                $game->pushCardToDurationAffects($this, RETURN_DURATION_TO_DISCARD, $isRealCard);
                $this->duration = RETURN_DURATION_TO_DISCARD;
                return true;
            }
        }
        $game->pushCardToDurationAffects($this, 1, $isRealCard);
        $game->cardActionFinished();
        return true;
    }

    public function cleanup(Game $game) {
        $game->moveCardFromPileToPile($this, PlayArea, DurationPileCards);
    }

    public function startTurn(Game $game, $quantity) {
        //$game->drawCards(3);
        if ($quantity > 0)
            return RETURN_DURATION_TO_DISCARD;
        else
            return DELETE_VIRTUAL_DURATION_CARD;
    }

}

?>